stage.set_background("schoolentrance")
stage.wait(2)
stage.create_grid_overlay(50, "blue")
stage.set_background_color("azure")
person1 = codesters.Sprite("person1")
person1.set_size(0.5)
t = codesters.Teacher()
params = t.get_parameters_for_function("Sprite")
try:
tval1 = params[1][0]
except:
tval1 = "DNE"
try:
tval2 = michael
except:
tval2 = "DNE"
try:
size_params = t.get_parameters_for_function('set_size')
tval3 = size_params[1][0]
tval3 = float(tval3)
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval2 != "DNE" and tval1 == '"person2"', "Great Job!")
t1.add_failure(tval1 == '"person2"' and tval2 == "DNE", "Did you name the sprite michael?")
t1.add_failure(tval1 is None, "Did you add Person2?")
t1.add_failure(tval1 == "DNE", "Did you add Person2?")
t1.add_creative(tval2 != "DNE" and tval1 != '"person2"', "That's a good sprite too!")
t2 = TestObjective()
t2.add_success(tval3 == .5, "Great job!")
t2.add_failure(tval3 == "DNE", "Did you drag out a Set Size block?")
t2.add_failure(tval3 > .5, "Too big! Set the size to 0.5")
t2.add_creative(tval3 > .3 and tval3 < .5, "That's a good size too!")
tester = TestManager()
tester.add_test_list([t1,t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)